import { reqMusicUrl } from "@/api";
const state = {
  getMusicLyric: {},
};
const mutations = {
  GETSINGMUSIC(state, data) {
    // state.newTrackList = data || [];
    state.getMusicLyric = data || [];
  },
};

const actions = {
//  获取播放源
  async getsingmusic({commit},data){
    const result = await reqMusicUrl(data);
    // console.log("zhang")
    // console.log(result)
    if (result.code == 200) {
      commit("GETSINGMUSIC",result.data[0] || {})
      return 'ok'
    } else {
      alert("暂无播放源");
      return Promise.reject(new Error('获取播放源错误'))
    }
  }
};

const getters = {};

export default {
  state,
  mutations,
  actions,
  getters,
};
